{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1 2 3]\n",
      " [1 2 3]] [7 8]\n"
     ]
    }
   ],
   "source": [
    "# 生成一个列表\n",
    "# np.array()   \n",
    "\n",
    "#np.linspace(start, stop, num=10, endpoint=True, retstep=False, dtype=None)，\n",
    "# 通俗意思就是按起点，终点，分为10份，endpoint:保留小数,retstep:分为俩部分（array，num）元组，array是结果数组，num是间隔大小\n",
    "# np.linspace(0,10,2) \n",
    "\n",
    "\n",
    "a = np.array([1,2,3])\n",
    "# 坐标向量\n",
    "b = np.array([7,8])\n",
    "# 生成网格点坐标矩阵\n",
    "c,d = np.meshgrid(a,b)    \n",
    "\n",
    "# 如: x = [1, 2, 3, 4]\n",
    "#     y = [7, 8, 9]\n",
    "   \n",
    "# x和y中的每一个元素组合生成\n",
    "# [[[1, 7], [2, 7], [3, 7], [4, 7]],\n",
    "#  [[1, 8], [2, 8], [3, 8], [4, 8]],\n",
    "#  [[1, 9], [2, 9], [3, 9], [4, 9]]]\n",
    " \n",
    "# 然后\n",
    "# 再分别放入X和Y中\n",
    "# X = [[1, 2, 3, 4],\n",
    "# \t [1, 2, 3, 4],\n",
    "# \t [1, 2, 3, 4]]\n",
    "\n",
    "# Y = [[7, 7, 7, 7],\n",
    "# \t [8, 8, 8, 8],\n",
    "# \t [9, 9, 9, 9],]\n",
    "\n",
    "print(c,b)"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "3cb250e525bdc45e0c81f60515e2b301d41451e11e00718716680ec78afef40b"
  },
  "kernelspec": {
   "display_name": "Python 3.8.8rc1 64-bit",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
